from django.db import models
from django.conf import settings

class HardContract(models.Model):
    SITE_CHOICES = [
        ('顶部', '顶部'),
        ('底部', '底部'),
        ('首页', '首页'),
    ]

    STATUS_CHOICES = [
        ('编辑中', '编辑中'),
        ('待审核', '待审核'),
        ('已发布', '已发布'),
    ]

    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    sign_date = models.DateField()
    start_time = models.DateField()
    end_time = models.DateField()
    site = models.CharField(max_length=20, choices=SITE_CHOICES)
    content = models.TextField()
    image_path = models.CharField(max_length=255, blank=True, null=True)
    video_path = models.CharField(max_length=255, blank=True, null=True)
    status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='编辑中')

    def __str__(self):
        return f"[硬广]{self.user.username} - {self.sign_date}"

class SoftContract(models.Model):
    MEDIA_CHOICES = [
        ('抖音', '抖音'),
        ('微博', '微博'),
        ('公众号', '公众号'),
    ]

    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    sign_date = models.DateField()
    start_time = models.DateField()
    end_time = models.DateField()
    media = models.CharField(max_length=20, choices=MEDIA_CHOICES)
    need = models.TextField()

    def __str__(self):
        return f"[软广]{self.user.username} - {self.sign_date}"

